package com.dy.yunying.api.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @projectName:pig
 * @description: 广点通优化目标
 * @author:Zhihao
 * @createTime:2020/12/9 15:06
 * @version:1.0
 */
public enum GdtOptimizationGoalEnum {

	OPTIMIZATIONGOAL_NONE("OPTIMIZATIONGOAL_NONE", "none",false),
	OPTIMIZATIONGOAL_BRAND_CONVERSION("OPTIMIZATIONGOAL_BRAND_CONVERSION", "品牌转化",false),
	OPTIMIZATIONGOAL_FOLLOW("OPTIMIZATIONGOAL_FOLLOW", "关注",false),
	OPTIMIZATIONGOAL_CLICK("OPTIMIZATIONGOAL_CLICK", "点击",false),
	OPTIMIZATIONGOAL_IMPRESSION("OPTIMIZATIONGOAL_IMPRESSION", "曝光",false),
	OPTIMIZATIONGOAL_APP_DOWNLOAD("OPTIMIZATIONGOAL_APP_DOWNLOAD", "下载",false),
	OPTIMIZATIONGOAL_APP_ACTIVATE("OPTIMIZATIONGOAL_APP_ACTIVATE", "激活",true),
	OPTIMIZATIONGOAL_APP_REGISTER("OPTIMIZATIONGOAL_APP_REGISTER", "注册",true),
	OPTIMIZATIONGOAL_ONE_DAY_RETENTION("OPTIMIZATIONGOAL_ONE_DAY_RETENTION", "次日留存",true),
	OPTIMIZATIONGOAL_APP_PURCHASE("OPTIMIZATIONGOAL_APP_PURCHASE", "付费次数",false),
	OPTIMIZATIONGOAL_ECOMMERCE_ORDER("OPTIMIZATIONGOAL_ECOMMERCE_ORDER", "下单",false),
	OPTIMIZATIONGOAL_ECOMMERCE_CHECKOUT("OPTIMIZATIONGOAL_ECOMMERCE_CHECKOUT", "H5购买",false),
	OPTIMIZATIONGOAL_LEADS("OPTIMIZATIONGOAL_LEADS", "销售线索",false),
	OPTIMIZATIONGOAL_ECOMMERCE_CART("OPTIMIZATIONGOAL_ECOMMERCE_CART", "加入购物车 ",false),
	OPTIMIZATIONGOAL_PROMOTION_CLICK_KEY_PAGE("OPTIMIZATIONGOAL_PROMOTION_CLICK_KEY_PAGE", "H5注册",false),
	OPTIMIZATIONGOAL_VIEW_COMMODITY_PAGE("OPTIMIZATIONGOAL_VIEW_COMMODITY_PAGE", "商品详情页浏览",false),
	OPTIMIZATIONGOAL_ONLINE_CONSULTATION("OPTIMIZATIONGOAL_ONLINE_CONSULTATION", "在线咨询 ",false),
	OPTIMIZATIONGOAL_TELEPHONE_CONSULTATION("OPTIMIZATIONGOAL_TELEPHONE_CONSULTATION", "电话拨打",false),
	OPTIMIZATIONGOAL_PAGE_RESERVATION("OPTIMIZATIONGOAL_PAGE_RESERVATION", "表单预约",false),
	OPTIMIZATIONGOAL_DELIVERY("OPTIMIZATIONGOAL_DELIVERY", "发货",false),
	OPTIMIZATIONGOAL_MESSAGE_AFTER_FOLLOW("OPTIMIZATIONGOAL_MESSAGE_AFTER_FOLLOW", "关注后发消息",false),
	OPTIMIZATIONGOAL_CLICK_MENU_AFTER_FOLLOW("OPTIMIZATIONGOAL_CLICK_MENU_AFTER_FOLLOW", "关注后点击菜单栏 ",false),
	OPTIMIZATIONGOAL_PAGE_EFFECTIVE_ONLINE_CONSULT("OPTIMIZATIONGOAL_PAGE_EFFECTIVE_ONLINE_CONSULT", "有效在线咨询",false),
	OPTIMIZATIONGOAL_PAGE_EFFECTIVE_PHONE_CALL("OPTIMIZATIONGOAL_PAGE_EFFECTIVE_PHONE_CALL", "有效电话拨打",false),
	OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_CONSULT("OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_CONSULT", "有效在线咨询",false),
	OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_PHONE("OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_PHONE", "有效电话拨打",false),
	OPTIMIZATIONGOAL_LEADS_COLLECT("OPTIMIZATIONGOAL_LEADS_COLLECT", "综合线索收集",false),
	OPTIMIZATIONGOAL_FIRST_PURCHASE("OPTIMIZATIONGOAL_FIRST_PURCHASE", "首次付费 ",true),
	OPTIMIZATIONGOAL_APPLY("OPTIMIZATIONGOAL_APPLY", "进件",false),
	OPTIMIZATIONGOAL_PRE_CREDIT("OPTIMIZATIONGOAL_PRE_CREDIT", "预授信",false),
	OPTIMIZATIONGOAL_CREDIT("OPTIMIZATIONGOAL_CREDIT", "授信",false),
	OPTIMIZATIONGOAL_WITHDRAW_DEPOSITS("OPTIMIZATIONGOAL_WITHDRAW_DEPOSITS", "提现",false),
	OPTIMIZATIONGOAL_PROMOTION_VIEW_KEY_PAGE("OPTIMIZATIONGOAL_PROMOTION_VIEW_KEY_PAGE", "关键页面访问",false),
	OPTIMIZATIONGOAL_MOBILE_APP_CREATE_ROLE("OPTIMIZATIONGOAL_MOBILE_APP_CREATE_ROLE", "小游戏创角",false),
	OPTIMIZATIONGOAL_CANVAS_CLICK("OPTIMIZATIONGOAL_CANVAS_CLICK", "跳转按钮点击",false),
	OPTIMIZATIONGOAL_PROMOTION_CLAIM_OFFER("OPTIMIZATIONGOAL_PROMOTION_CLAIM_OFFER", "领券",false),
	OPTIMIZATIONGOAL_ECOMMERCE_ADD_TO_WISHLIST("OPTIMIZATIONGOAL_ECOMMERCE_ADD_TO_WISHLIST", "商品收藏",false),
	OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_RESERVATION("OPTIMIZATIONGOAL_CONFIRM_EFFECTIVE_LEADS_RESERVATION", "有效表单预约",false),
	OPTIMIZATIONGOAL_PAGE_RECEIPT("OPTIMIZATIONGOAL_PAGE_RECEIPT", "签收",false),
	OPTIMIZATIONGOAL_PAGE_SCAN_CODE("OPTIMIZATIONGOAL_PAGE_SCAN_CODE", "加企业微信客服",false),
	OPTIMIZATIONGOAL_SELECT_COURSE("OPTIMIZATIONGOAL_SELECT_COURSE", "选课",false),
	OPTIMIZATIONGOAL_CONFIRM_POTENTIAL_CUSTOMER_PHONE("OPTIMIZATIONGOAL_CONFIRM_POTENTIAL_CUSTOMER_PHONE", "电话潜在客户",false),
	OPTIMIZATIONGOAL_MOBILE_APP_AD_INCOME("OPTIMIZATIONGOAL_MOBILE_APP_AD_INCOME", "广告变现",false),
	OPTIMIZATIONGOAL_MOBILE_APP_ACCREDIT("OPTIMIZATIONGOAL_MOBILE_APP_ACCREDIT", "小游戏授权",false),
	OPTIMIZATIONGOAL_PURCHASE_MEMBER_CARD("OPTIMIZATIONGOAL_PURCHASE_MEMBER_CARD", "首次会员购买",false),
	OPTIMIZATIONGOAL_PAGE_CONFIRM_EFFECTIVE_LEADS("OPTIMIZATIONGOAL_PAGE_CONFIRM_EFFECTIVE_LEADS", "有效综合线索",false),
	OPTIMIZATIONGOAL_ADD_DESKTOP("OPTIMIZATIONGOAL_ADD_DESKTOP", "快应用加桌面",false),
	OPTIMIZATIONGOAL_RESERVATION("OPTIMIZATIONGOAL_RESERVATION", "微信流量预约行为",false),
	OPTIMIZATIONGOAL_FIRST_ECOMMERCE_ORDER("OPTIMIZATIONGOAL_FIRST_ECOMMERCE_ORDER", "首次下单",false),
	OPTIMIZATIONGOAL_LIKE("OPTIMIZATIONGOAL_LIKE", "点赞",false),
	OPTIMIZATIONGOAL_EXTERNAL_LINK_CLICK("OPTIMIZATIONGOAL_EXTERNAL_LINK_CLICK", "外链点击",false),
	OPTIMIZATIONGOAL_BUY_COUPONS("OPTIMIZATIONGOAL_BUY_COUPONS", "购券",false),
	OPTIMIZATIONGOAL_LEAVE_INFORMATION("OPTIMIZATIONGOAL_LEAVE_INFORMATION", "留资",false),
	OPTIMIZATIONGOAL_CORE_ACTION("OPTIMIZATIONGOAL_CORE_ACTION", "关键行为",false),
	OPTIMIZATIONGOAL_ONE_DAY_RETENTION_RATIO("OPTIMIZATIONGOAL_ONE_DAY_RETENTION_RATIO", "次留率",false),
	OPTIMIZATIONGOAL_INSURANCE_PURCHASE("OPTIMIZATIONGOAL_INSURANCE_PURCHASE", "保险支付",false),
	OPTIMIZATIONGOAL_PROMOTION_READ_ARTICLE("OPTIMIZATIONGOAL_PROMOTION_READ_ARTICLE", "阅读文章",false);

	//枚举值所包含的属性
	/**
	 * 类型
	 */
	private String type;

	/**
	 * 名称
	 */
	private String name;
	/**
	 * 是否可用
	 */
	private boolean isAavailable;

	//构造方法
	GdtOptimizationGoalEnum(String type, String name, boolean isAavailable) {
		this.type = type;
		this.name = name;
		this.isAavailable = isAavailable;
	}

	public String getType() {
		return type;
	}

	public String getName() {
		return name;
	}

	/**
	 * 通过value    取type
	 *
	 * @return
	 */
	public static String typeByValue(String value) {
		if (StringUtils.isBlank(value)) {
			return null;
		}

		for (GdtAutoExpanEnableEnum item : GdtAutoExpanEnableEnum.values()) {
			if (item.getName().equals(value)) {
				return item.getType();
			}
		}
		return null;

	}

	/**
	 * 通过type   取value
	 *
	 * @return
	 */
	public static String valueByType(String type) {
		if (StringUtils.isBlank(type)) {
			return null;
		}

		for (GdtOptimizationGoalEnum item : GdtOptimizationGoalEnum.values()) {
			if (item.getType().equals(type)) {
				return item.getName();
			}
		}
		return null;

	}

	public static boolean containsType(String type) {
		if (StringUtils.isBlank(type)) {
			return false;
		}

		for (GdtOptimizationGoalEnum item : GdtOptimizationGoalEnum.values()) {
			if (item.getType().equals(type)) {
				return true;
			}
		}
		return false;
	}
	public static boolean checkAavailable(String type){
		if (StringUtils.isBlank(type)) {
			return false;
		}

		for (GdtOptimizationGoalEnum item : GdtOptimizationGoalEnum.values()) {
			if (item.isAavailable&&item.getType().equals(type)) {
				return true;
			}
		}
		return false;
	}
}
